import instance from '../util/request'
/**
 * 获取商品列表
 * @returns  
 */
export const list = (page)=>{ 
  return instance.get("/goods",{
    headers:{'Content-Type':'application/json'},
    params:page
  })
}

/**
 * 获取商品详情
 * @returns  
 */
export const good_detail = (map)=>{ 
  return instance.get("/goods/detail",{
    params:map
  })
}
export const del_good=(id)=>{
  return instance.delete("/goods",{
    params:{id}
  })
}
/**
 * 根据id获取商品
 * @returns  
 */
export const good_by_id = (id)=>{ 
  return instance.get("/goods/id",{
    headers:{'Content-Type':'application/json'},
    params:{id}
  })
}
/**
 * 添加商品
 */
export const good_add=(data)=>{
  return instance.post("/goods",{
    headers:{'Content-Type':'application/json'},
    data:data
  })
}

/**
 * 搜索
 * @returns  
 */
export const search = (Key="")=>{ 
  return instance.get(`/goods/${Key}`,{headers:{'Content-Type':'application/json'}})
}

